__author__ = 'deadmoroz'

class Language(object):
    def __init__(self, map):
        default = self.__default()
        self.__dict__.update(default)
        for field in map:
            if field in default:
                self.__dict__[field] = map[field]

    def __default(self):
        return {
            "caseInsensitive": False,
            "defaultMode": None,
            "name": None
        }


class Mode(object):
    def __init__(self, dict):
        default = self.__default()
        self.__dict__.update(default)
        for field in dict:
            if field in default:
                self.__dict__[field] = dict[field]

    def __default(self):
        return {
            "compiled": False,
            "begin": "",
            "end": None,
            "endsWithParent": False,
            "illegal": None,
            "illegalRe": None,
            "contains": [],
            "keywords": {},
            "starts": None,
            "lexems": [],
            "terminators": [],
            "subLanguage": None,
            "lexemsRe": None,
            "className": None,
            "returnBegin": False,
            "excludeBegin": False,
            "excludeEnd": False,
            "returnEnd": False
        }
